package cn.darkhorse.pick.service.impl;

import java.util.List;
import java.util.Map;

import cn.darkhorse.pick.pojo.PickInfo;
import cn.darkhorse.pick.mapper.PickInfoMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.darkhorse.pick.service.IPickInfoService;
import com.ruoyi.common.core.text.Convert;

/**
 * 采摘信息Service业务层处理
 *
 * @author ruoyi
 * @date 2021-05-16
 */
@Service
public class PickInfoServiceImpl extends ServiceImpl<PickInfoMapper, PickInfo> implements IPickInfoService
{
    @Autowired
    private PickInfoMapper pickInfoMapper;

    /**
     * 查询采摘信息
     *
     * @param pickInfoId 采摘信息ID
     * @return 采摘信息
     */
    @Override
    public PickInfo selectPickInfoById(Long pickInfoId)
    {
        return pickInfoMapper.selectPickInfoById(pickInfoId);
    }

    /**
     * 查询采摘信息列表
     *
     * @param pickInfo 采摘信息
     * @return 采摘信息
     */
    @Override
    public List<PickInfo> selectPickInfoList(PickInfo pickInfo)
    {
        return pickInfoMapper.selectPickInfoList(pickInfo);
    }

    /**
     * 新增采摘信息
     *
     * @param pickInfo 采摘信息
     * @return 结果
     */
    @Override
    public int insertPickInfo(PickInfo pickInfo)
    {
        pickInfo.setCreateTime(DateUtils.getNowDate());
        return pickInfoMapper.insertPickInfo(pickInfo);
    }

    /**
     * 修改采摘信息
     *
     * @param pickInfo 采摘信息
     * @return 结果
     */
    @Override
    public int updatePickInfo(PickInfo pickInfo)
    {
        pickInfo.setUpdateTime(DateUtils.getNowDate());
        return pickInfoMapper.updatePickInfo(pickInfo);
    }

    /**
     * 删除采摘信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePickInfoByIds(String ids)
    {
        return pickInfoMapper.deletePickInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除采摘信息信息
     *
     * @param pickInfoId 采摘信息ID
     * @return 结果
     */
    @Override
    public int deletePickInfoById(Long pickInfoId)
    {
        return pickInfoMapper.deletePickInfoById(pickInfoId);
    }

    /**
     * 查询采摘信息
     *
     * @param sampleNumber 追溯码
     * @return 采摘信息
     */
    @Override
    public PickInfo selectPickInfoByCode(String sampleNumber)
    {
        return pickInfoMapper.selectPickInfoByCode(sampleNumber);
    }
    /**
     * 今日采摘统计
     *
     * @param pickInfo 采摘信息
     * @return 交售信息
     */
    @Override
    @DataScope(deptAlias = "d")
    public List<Map<String,String>> getPickInfoCount(PickInfo pickInfo){
        return pickInfoMapper.getPickInfoCount(pickInfo);
    }

    /**
     * 查询采摘数量
     *
     * @param pickInfo 采摘信息
     * @return 采棉机管理集合
     */
    @Override
    @DataScope(deptAlias = "d")
    public int selectPickInfoCount(PickInfo pickInfo)
    {
        return pickInfoMapper.selectPickInfoCount(pickInfo);
    }
}
